Adding some more judges, here and there.
[and.git] / UVa / 10298 - Power Strings / D.c
blobebf04cb13b6a7aabb4c039f4ad4ff2fe83d987c7
1 #include <stdio.h>
3 char s[2000002];
5 main(){
6 int i,j,k,m,n;
7 while (gets(s) && strcmp(s,".")) {
8 m = n = strlen(s);
9 for (i=2;i<=n;i++) {
10 while (n%i == 0) {
11 n /= i;
12 for (j=0;j<m-m/i && s[j] == s[j+m/i];j++);
13 if (j == m-m/i) m /= i;
16 printf("%d\n",strlen(s)/m);